import request from '@utils/request'

// 站点设置-->banner列表 获取banner数据
const fetchBanners = (params = {}) => request.get('/banner/list', {
  params
})

// 商城模块-->商品类别 获取商品分类数据
const fetchCates = (params = {}) => request.get('/shop/goods/category/all', {
  params
})

// 商城模块-->商品列表 获取商品列表数据
const fetchGoods = (params = {}) => request.post('/shop/goods/list/v2', params)

// 商城模块-->商品详情 获取商品详情数据
const fetchDetails = (params = {}) => request.get('/shop/goods/detail', {
  params
})

// 用户管理-->用户登录[用户名] 获取用户登录数据
const fetchLogin = (params = {}) => request.post('/user/username/login', params)

// 用户管理-->用户注册[用户名注册] 获取用户注册数据
const fetchRegistry = (params = {}) => request.post('/user/username/register', params)

// 购物车-->加入购物车 获取加入购物车商品数据
const addCart = (params = {}) => request.post('/shopping-cart/add', params)

export {
  fetchBanners,
  fetchCates,
  fetchGoods,
  fetchDetails,
  fetchLogin,
  fetchRegistry,
  addCart
}
